package com.xxwy.springcloud.controller;

import com.xxwy.springcloud.entity.Dept;
import com.xxwy.springcloud.service.IDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author xxwy
 * on 2018/9/29 0029
 */
@RestController
@RequestMapping("dept")
public class DeptController {
    @Autowired
    private IDeptService service;
    @Autowired
    private DiscoveryClient cliet;

    @PostMapping(value = "/add")
    public boolean add(Dept dept) {
        return service.add(dept);
    }

    @GetMapping(value = "/get/{id}")
    public Dept get(@PathVariable("id") Long id) {
        return service.get(id);
    }

    @GetMapping(value = "/list")
    public List<Dept> list() {
        return service.list();
    }




}
